﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.Data.Objects.DataClasses;

namespace FinalProject.DAL.Model
{

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName = "InvoiceModel", Name = "InvoiceDocument")]
    [Serializable()]
    [DataContractAttribute(IsReference = true)]
    public partial class InvoiceDocument : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InvoiceDocument object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="docNumber">Initial value of the DocNumber property.</param>
        /// <param name="docDate">Initial value of the DocDate property.</param>
        /// <param name="totalAmount">Initial value of the TotalAmount property.</param>
        /// <param name="vATRate">Initial value of the VATRate property.</param>
        /// <param name="payMode">Initial value of the PayMode property.</param>
        /// <param name="deliveryDocumentId">Initial value of the DeliveryDocumentId property.</param>
        /// <param name="journalId">Initial value of the JournalId property.</param>
        /// <param name="CustomerId">Initial value of the CustomerId property.</param>
        public static InvoiceDocument CreateInvoiceDocument(global::System.Guid id, global::System.Int32 docNumber, global::System.DateTime docDate, global::System.Decimal totalAmount, global::System.Int16 payMode, global::System.Guid deliveryDocumentId, global::System.Guid journalId, global::System.Guid CustomerId)
        {
            InvoiceDocument invoiceDocument = new InvoiceDocument();
            invoiceDocument.Id = id;
            invoiceDocument.DocNumber = docNumber;
            invoiceDocument.DocDate = docDate;
            invoiceDocument.TotalAmount = totalAmount;
            invoiceDocument.PayMode = payMode;
            invoiceDocument.DeliveryDocumentId = deliveryDocumentId;
            invoiceDocument.JournalId = journalId;
            invoiceDocument.CustomerId = CustomerId;
            return invoiceDocument;
        }

        #endregion

        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Int32? DocNumber
        {
            get
            {
                return _DocNumber;
            }
            set
            {
                OnDocNumberChanging(value);
                ReportPropertyChanging("DocNumber");
                _DocNumber = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DocNumber");
                OnDocNumberChanged();
            }
        }
        private global::System.Int32? _DocNumber;
        partial void OnDocNumberChanging(global::System.Int32? value);
        partial void OnDocNumberChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.DateTime? DocDate
        {
            get
            {
                return _DocDate;
            }
            set
            {
                OnDocDateChanging(value);
                ReportPropertyChanging("DocDate");
                _DocDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DocDate");
                OnDocDateChanged();
            }
        }
        private global::System.DateTime? _DocDate;
        partial void OnDocDateChanging(global::System.DateTime? value);
        partial void OnDocDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Decimal? TotalAmount
        {
            get
            {
                return _TotalAmount;
            }
            set
            {
                OnTotalAmountChanging(value);
                ReportPropertyChanging("TotalAmount");
                _TotalAmount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TotalAmount");
                OnTotalAmountChanged();
            }
        }
        private global::System.Decimal? _TotalAmount;
        partial void OnTotalAmountChanging(global::System.Decimal? value);
        partial void OnTotalAmountChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Int16? PayMode
        {
            get
            {
                return _PayMode;
            }
            set
            {
                OnPayModeChanging(value);
                ReportPropertyChanging("PayMode");
                _PayMode = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("PayMode");
                OnPayModeChanged();
            }
        }
        private global::System.Int16? _PayMode;
        partial void OnPayModeChanging(global::System.Int16? value);
        partial void OnPayModeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid DeliveryDocumentId
        {
            get
            {
                return _DeliveryDocumentId;
            }
            set
            {
                OnDeliveryDocumentIdChanging(value);
                ReportPropertyChanging("DeliveryDocumentId");
                _DeliveryDocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DeliveryDocumentId");
                OnDeliveryDocumentIdChanged();
            }
        }
        private global::System.Guid _DeliveryDocumentId;
        partial void OnDeliveryDocumentIdChanging(global::System.Guid value);
        partial void OnDeliveryDocumentIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid JournalId
        {
            get
            {
                return _JournalId;
            }
            set
            {
                OnJournalIdChanging(value);
                ReportPropertyChanging("JournalId");
                _JournalId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("JournalId");
                OnJournalIdChanged();
            }
        }
        private global::System.Guid _JournalId;
        partial void OnJournalIdChanging(global::System.Guid value);
        partial void OnJournalIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid CustomerId
        {
            get
            {
                return _CustomerId;
            }
            set
            {
                OnCustomerIdChanging(value);
                ReportPropertyChanging("CustomerId");
                _CustomerId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CustomerId");
                OnCustomerIdChanged();
            }
        }
        private global::System.Guid _CustomerId;
        partial void OnCustomerIdChanging(global::System.Guid value);
        partial void OnCustomerIdChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "DeliveryDocumentInvoiceDocument", "DeliveryDocument")]
        public DeliveryDocument DeliveryDocument
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentInvoiceDocument", "DeliveryDocument").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentInvoiceDocument", "DeliveryDocument").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<DeliveryDocument> DeliveryDocumentReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentInvoiceDocument", "DeliveryDocument");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentInvoiceDocument", "DeliveryDocument", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "InvoiceDocumentCollectionMoney", "CollectionMoney")]
        public EntityCollection<CollectionMoney> CollectionMoneys
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<CollectionMoney>("InvoiceModel.InvoiceDocumentCollectionMoney", "CollectionMoney");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<CollectionMoney>("InvoiceModel.InvoiceDocumentCollectionMoney", "CollectionMoney", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "InvoiceDocumentDocumentRow", "DocumentRow")]
        public EntityCollection<DocumentRow> DocumentRows
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<DocumentRow>("InvoiceModel.InvoiceDocumentDocumentRow", "DocumentRow");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<DocumentRow>("InvoiceModel.InvoiceDocumentDocumentRow", "DocumentRow", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "JournalInvoiceDocument", "Journal")]
        public Journal Journal
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Journal>("InvoiceModel.JournalInvoiceDocument", "Journal").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Journal>("InvoiceModel.JournalInvoiceDocument", "Journal").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Journal> JournalReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Journal>("InvoiceModel.JournalInvoiceDocument", "Journal");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Journal>("InvoiceModel.JournalInvoiceDocument", "Journal", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "CustomerInvoiceDocument", "Customer")]
        public Customer Customer
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerInvoiceDocument", "Customer").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerInvoiceDocument", "Customer").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customer> CustomerReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerInvoiceDocument", "Customer");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customer>("InvoiceModel.CustomerInvoiceDocument", "Customer", value);
                }
            }
        }

        #endregion
    }
}
